﻿using System;
using System.Collections.Generic;

using SharedGenomics.Core;
using SharedGenomics.Workbench.Core;
using SharedGenomics.Domain;

namespace SharedGenomics.Workbench.Services
{
    public class FileSetRepository : WCFClientHost, IFileSetRepository
    {
        public Maybe<EntityInfo[]> GetUserFileSets()
        {
            return this.ExecuteProxyContract<DataService.IDataService, EntityInfo[]>(ds => ds.GetUserFileSetInfos()).Just();
        }

        public Maybe<FileSetInfo> GetById(int fileSetId)
        {
            return this.ExecuteProxyContract<DataService.IDataService, FileSetInfo>(ds =>
            {
                var fsi = ds.GetFileSetById(fileSetId, true);
                return new FileSetInfo { Id = fsi.Id, Name = fsi.Name, Schema = fsi.Schema };
            }).Just();
        }
    }
}
